package com.jeesite.modules.car.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.entity.TreeEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 分类表Entity
 * @author T
 * @version 2023-12-11
 */
@Table(name="h_car_type", alias="a", label="分类表信息", columns={
		@Column(name="type_code", attrName="typeCode", label="节点编码", isPK=true),
		@Column(name="big_type", attrName="bigType", label="归属大类", comment="归属大类（0摩托车 1汽车）"),
		@Column(name="parent_code", attrName="parent.typeCode", label="父级编号", isParentCode=true),
		@Column(includeEntity=TreeEntity.class),
		@Column(name="tree_name", attrName="treeName", label="节点名称", queryType=QueryType.LIKE, isTreeName=true),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.tree_sorts, a.type_code"
)
public class CarType extends TreeEntity<CarType> {
	
	private static final long serialVersionUID = 1L;
	private String typeCode;		// 节点编码
	private String bigType;		// 归属大类（0摩托车 1汽车）
	private String treeName;		// 节点名称

	public CarType() {
		this(null);
	}
	
	public CarType(String id){
		super(id);
	}
	
	@Override
	public CarType getParent() {
		return parent;
	}

	@Override
	public void setParent(CarType parent) {
		this.parent = parent;
	}
	
	public String getTypeCode() {
		return typeCode;
	}

	public void setTypeCode(String typeCode) {
		this.typeCode = typeCode;
	}
	
	@NotBlank(message="归属大类不能为空")
	@Size(min=0, max=64, message="归属大类长度不能超过 64 个字符")
	public String getBigType() {
		return bigType;
	}

	public void setBigType(String bigType) {
		this.bigType = bigType;
	}
	
	@NotBlank(message="节点名称不能为空")
	@Size(min=0, max=200, message="节点名称长度不能超过 200 个字符")
	public String getTreeName() {
		return treeName;
	}

	public void setTreeName(String treeName) {
		this.treeName = treeName;
	}

}